package com.mep.backup.feign;

import com.mep.common.http.HttpResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.io.IOException;

@FeignClient(value = "story-backup/user", path = "/", fallback = IFeignMySqlBackupApi.FeignClientFallback.class)
public interface IFeignMySqlBackupApi {
//    @ApiOperation(value="01.backup信息获取",notes="问题点:backup信息获取")
//    @ApiOperationSupport(order = 1, author = "lyl")
    @PostMapping("/backup")
    HttpResult backup();

//    @ApiOperation(value="02.重新保存backup信息",notes="问题点:重新保存backup信息")
//    @ApiOperationSupport(order = 2, author = "lyl")
    @PostMapping("/restore")
    HttpResult restore(@RequestParam String name) throws IOException;

//    @ApiOperation(value="03.查询backup信息",notes="问题点:查询backup信息")
//    @ApiOperationSupport(order = 3, author = "lyl")
    @PostMapping("/findRecords")
    HttpResult findBackupRecords();

//    @ApiOperation(value="04.删除backup信息",notes="问题点:删除backup信息")
//    @ApiOperationSupport(order = 4, author = "lyl")
    @PostMapping("/delete")
    HttpResult deleteBackupRecord(@RequestParam String name);

    @Component
    class FeignClientFallback implements IFeignMySqlBackupApi {

        @Override
        public HttpResult backup() {
            return null;
        }

        @Override
        public HttpResult restore(String name) throws IOException {
            return null;
        }

        @Override
        public HttpResult findBackupRecords() {
            return null;
        }

        @Override
        public HttpResult deleteBackupRecord(String name) {
            return null;
        }
    }
}
